#include "rclcpp/rclcpp.hpp"

class PersonNode : public rclcpp::Node
{
private:
    /* data */
    std::string name;
    int age ;
public:
    
    PersonNode(const std::string &node_name ,const std::string &name,const int &age) :Node(node_name)
    {
        this->name=name;
        this->age=age;

    };

    void eat(const std::string &food)
    {
        RCLCPP_INFO(get_logger(),"%s,%d岁,喜欢吃%s",this->name.c_str(),this->age,food.c_str());
    };


};

int main(int argc, char** argv)
{
    rclcpp::init(argc,argv);
    auto node=std::make_shared<PersonNode>("person","One",18);

    
    node->eat("米饭");

    rclcpp::spin(node);
    rclcpp::shutdown();

    return 0;
}
